<html> 
<html> 
	<head> 
		<title>m-Events</title>
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css" />
		<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
		<script src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script>
		<script src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
	</head> 
<body>
<script type="text/javascript">
        function resetTextFields()
        {
            $("#email").val("");
            $("#pass").val("");
			$("#name").val("");
			$("#telp").val("");
			$("#com").val("");
        }
 
        function onSuccess(data, status)
        {
            resetTextFields();
            // Notify the user the new post was saved
            $("#notification").fadeIn(2000);
            data = $.trim(data);
            if(data == "SUCCESS")
            {
                $("#notification").css("background-color", "#ffff00");
                $("#notification").text("Registration Success");
            }
            else
            {
                $("#notification").css("background-color", "#ff0000");
                $("#notification").text("Registration Failed");
            }
            $("#notification").fadeOut(5000);
        }
		
 
        $(document).ready(function() {
			$("#submit").click(function(){
			$("#register").validate();
			if($("#register").valid()){
                var formData = $("#register").serialize();
 
                $.ajax({
                    type: "POST",
                    url: "/app/mobile-event-portal/signup.php",
                    cache: false,
                    data: formData,
                    success: onSuccess,
                });
			}
 
                return false;
            });
 
            $("#cancel").click(function(){
                resetTextFields();
            });
 
            $("#refresh").click(function(){
                location.reload();
            });
			
        });
 
    </script>